package HibernateOrederManagement.app;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;

import HibernateOrderManagerment.bean.User;

public class RegisterDao {
	private Session session;
	public RegisterDao(Session session){
		this.session=session;
	}
	
	public boolean register(User user){
		Transaction tx= session.beginTransaction();
		try{
			session.save(user);
			tx.commit();
		}catch(HibernateException e){
			e.printStackTrace();
			tx.rollback();
			return false;
		}
		return true;
	}

}
